package Test6;
//长方形
public class Rectangle extends Figure {
    private double length;
    private double width;

    public Rectangle() {
    }
    public Rectangle(double length, double width) {
        this.length = length;
        this.width = width;
    }

    public double getLength() {
        return length;
    }
    public void setLength(double length) {
        this.length = length;
    }
    public double getWidth() {
        return width;
    }
    public void setWidth(double width) {
        this.width = width;
    }

    @Override
    public void perimeter() {
        System.out.println("长方形周长为:"+(this.getLength()+this.getWidth())*2);
    }

    @Override
    public void area() {
        System.out.println("长方形面积为:"+(this.getWidth()*this.getLength()));
    }
}
